package routers

import (
	"certificate-manager/routers/api"
	"github.com/gin-gonic/gin"
)

// InitRouter initialize routing information
func InitRouter() *gin.Engine {
	r := gin.New()
	r.Use(gin.Logger())
	r.Use(gin.Recovery())

	apiv1 := r.Group("/api/v1")
	{
		//1、检查letsencrypt账号状态
		apiv1.GET("/letsencrypt/account/validation", api.ValidateAccount)
		//2、手动触发定时任务
		apiv1.GET("/task/trigger", api.TriggerTask)
		//3、手动添加域名
		apiv1.POST("/domain", api.AddDomain)
		//4、查询Redis中数据，写入文件
		apiv1.GET("/file/sync", api.SyncCaFileFromRedis)

	}
	return r
}
